package main

import (
	"fmt"
)

type Writer struct {
}

func (t Writer) Speak() {
	fmt.Printf("我是作家")
}

type Teacher struct {
}

func (t Teacher) Speak() {
	fmt.Printf("我是老师")
}

type Student struct {
}

func (t Student) Speak() {
	fmt.Printf("我是学生")
}

type SpeakerTypes interface {
	Teacher | Student
	Speak()
}

type Speaker[T SpeakerTypes] struct {
	Internal T
}

func (s Speaker[T]) Speak() {
	s.Internal.Speak()
}

func main5() {
	speaker := Speaker[Student]{}
	speaker.Speak()
}
